//
//  ComposePicSelectorViewItem.swift
//  WBSwift
//
//  Created by 贺瑞 on 2017/8/11.
//  Copyright © 2017年 herui. All rights reserved.
//

import UIKit


protocol ComposePicSelectorViewItemDelegate : NSObjectProtocol{
    func composePicSelectorViewItemDelBtnOnclick(cell : ComposePicSelectorViewItem)
}

class ComposePicSelectorViewItem: UICollectionViewCell {
    
    @IBOutlet weak var imageV: UIImageView!
    @IBOutlet weak var delBtn: UIButton!
    
    weak var delegate : ComposePicSelectorViewItemDelegate?
    

    var image: UIImage? {
        didSet{
            if image == nil {
                imageV.image = #imageLiteral(resourceName: "compose_pic_add")
                delBtn.isHidden = true
            }else{
                imageV.image = image
                delBtn.isHidden = false
            }
        }
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }

    
    @IBAction func delBtnOnclick(_ sender: UIButton) {
        delegate?.composePicSelectorViewItemDelBtnOnclick(cell: self)
    }

    
}
